<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>粗细集料,矿料</title>
<style type="text/css">
.detect {
	width: 100%;
}

.detect td {
	padding: 0.2em 0px 0.2em 8px;
	width: 50px;
}

.detect th {
	text-align: center;
}

.detect td input[type="text"] {
	width: 55px;
	text-align: center;
}
</style>
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script type='text/javascript'
	src='${ctx}/scripts/plugin/jquery.liveSearch.js'></script>
<script type="text/javascript">
	var tr_id = 2;
	$(document)
			.ready(
					function() {
						$("#reportDate").addClass("Wate").bind("click",
								function() {
									WdatePicker({
										skin : 'whyGreen',
										minDate : '1900-10-01',
										dateFmt : 'yyyy-MM-dd'
									});
								});
						$("#checkdate").addClass("Wate").bind("click",
								function() {
									WdatePicker({
										skin : 'whyGreen',
										minDate : '1900-10-01',
										dateFmt : 'yyyy-MM-dd'
									});
								});
						

						if(${ not empty id}){
							$("#projName").attr("disabled",true);
						}
						
						$("#inputForm").validate({
							event : "blur",
							isTip : true
						});

						$("#add")
								.click(
										function() {
											tr_id++;
											var str = "<tr id='"+tr_id+"'>"
													+ "<td>【<input type='button'value='删除' onclick='del("
													+ tr_id
													+ ")'>】"
													+ "<input size='10' type='text' class='required'  name='trialwt04s["+ tr_id+ "].name'></td>"
													+ "<td><input size='8'  class='required'  style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].category'></td>"
													+ "<td><input size='8' style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].gradation'></td>"
													+ "<td><input size='5' class='required' style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].count'></td>"
													+ "<td><input size='2' class='required' style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].amount'></td>"
													+ "<td><input size='8' style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].origin'></td>"
													+ "<td><input size='8' style='width: 100%' type='text' name='trialwt04s["
													+ tr_id
													+ "].source'></td>"
													+ "</tr>";
											$("#tab").append(str);
										});
						$("#save").click(function() {
							var checkedBox = $("input[name=ord]:checked");
							var siz = checkedBox.size();
							var relaId = $("#relationId").val();
							if (siz < 1) {
								alert("请至少勾选一个检验项目！");
								return false;
							} else if (relaId == "") {
								alert("工程名称是无效数据!");
								return false;
							}
							return true;
						});

						$("#projName")
								.liveSearch(
										{
											url : '${ctx}/project/relationship!findDimQuery.action?q='
										});
					});
	function del(id) {
		//alert(id);
		$('#' + id).remove();
	}

	function deletedesign(url) {
		$.ajax({
			type : "POST",
			url : url,
			success : function(msg) {
				if (msg == "1") {
					alert("删除成功!");
					window.returnValue = true;
					window.close();
				} else {
					alert("删除失败!");
				}
			}
		});
	}
	function setValue(projName, relationId) {
		url = '${ctx}/project/relationship!findByRelation.action?ralationId='
				+ relationId;
		$
				.ajax({
					type : "POST",
					url : url,
					dataType : 'html',
					success : function(msg) {
						relationObj = eval(msg);
						if (relationObj.success) {
							$("#entrustorgid").val(
									relationObj.relationship.entrustorgid);
							$("#witnessorgid").val(
									relationObj.relationship.witnessorgid);
							$("#witnesses").val(
									relationObj.relationship.witnesses);
							$("#wphone").val(relationObj.relationship.wphone);
							$("#operations").val(
									relationObj.relationship.operations);
							$("#ophone").val(relationObj.relationship.ophone);
							$("#checkpeople").val(
									relationObj.relationship.checkpeople);
							$("#checkphone").val(
									relationObj.relationship.checkphone);
						} else {
							alert("没有检索到数据!");
						}
					},
					error : function(msg) {
						alert("系统出错,请联系管理员");
					}
				});

		$("#projName").val(projName);
		$("#relationId").val(relationId);
		$("#jquery-live-search").fadeOut();
	}

	function close() {
		$.window.closeAll();
	}

	function setProjName(relaId, entrustorgid, witnessorgid, projName,
			witnesses, wphone, operations, ophone, checkpeople, checkphone) {
		$("#relationId").val(relaId);
		$("#entrustorgid").val(entrustorgid);
		$("#witnessorgid").val(witnessorgid);
		$("#projName").val(projName);
		$("#witnesses").val(witnesses);
		$("#wphone").val(wphone);
		$("#operations").val(operations);
		$("#ophone").val(ophone);
		$("#checkpeople").val(checkpeople);
		$("#checkphone").val(checkphone);

	}

	function addOrg() {
		$("#jquery-live-search").hide();
		var url = "${ctx}/project/relationship!input.action";
		mm = showWindow('项目单位添加', url);
		if (mm) {
			if (mm.projName) {
				$("#projName").val(mm.projName);
			}
			if (mm.projId) {
				$("#projId").val(mm.projId);
			}
		}
	}
</script>
</head>
<body>
	<form action="${ctx}/receive/wt04/trialwt04!save.action" method="post"
		id="inputForm" class="yform">
		<table>
			<tr>
				<td style="width: 110px">工程名称</td>
				<td colspan="4"><input id="projName" name="projName"  class="required"
					value="${relationship.proj.projName }" /> <input type="hidden"
					id="relationId" name="relationId" value="${relationId}" /></td>
				<td style="width: 100px">委托编号</td>
				<td colspan="2">${entrustNum }<input name="entrustNum"
					type="hidden" value="${entrustNum }"></td>
				<input name="id" type="hidden" value="${id}" />
			</tr>
			<tr>
				<td>委托单位</td>
				<td colspan="4"><input id="entrustorgid" name="entrustorgid"
					readonly="readonly" value="${relationship.entrustorgid}" /></td>
				<td>送检日期</td> 
				<td colspan="2"><input id="checkdate" name="checkdate"  class="required"
					value="${checkdate}" readonly="readonly" /></td>
			</tr>
			<tr>
				<td>检验类别</td>
				<td colspan="4"><pt:code category="5001" name="checktype"
						default="${checktype}"></pt:code></td>
				<td>样品处理意见</td>
				<td><input type="radio" name="idea" value="0"
					<c:if test="${idea != 1 }"> checked="checked"</c:if>>不退样</td>
				<td><input type="radio" name="idea" value="1"
					<c:if test="${idea == 1 }"> checked="checked"</c:if>>退样</td>
			</tr>
			<tr>
				<td>见证单位</td>
				<td colspan="3"><input type="text" name="witnessorgid"
					id="witnessorgid" value="${relationship.witnessorgid }"></td>
				<td align="right">见证人</td>
				<td><input size="10" name="witnesses" type="text"
					id="witnesses" value="${witnesses }"></td>
				<td style="width: 70px">联系电话</td>
				<td align="left"><input style="width: 110px; text-align: left"
					type="text" name="wphone" id="wphone" value="${wphone }"></td>
			</tr>
			<tr>
				<td>委托送样人</td>
				<td><input style="width: 100%" type="text" name="operations"
					id="operations" value="${ operations}"></td>
				<td style="width: 100px; text-align: right;">联系电话</td>
				<td><input style="width: 100%" type="text" name="ophone"
					size="15" id="ophone" value="${ ophone}"></td>
				<td style="width: 70px" align="right">抽检人</td>
				<td><input type="text" name="checkpeople" size="10"
					id="checkpeople" value="${ checkpeople}"></td>
				<td>联系电话</td>
				<td align="left"><input type="text" name="checkphone"
					style="width: 110px" id="checkphone" value="${checkphone }"></td>
			</tr>
		</table>
		<table>
			<tr>
				<td rowspan="2">检验项目依据标准</td>
				<td rowspan="2">
					<table>
						<tr>
							<td>1: 砼试件 : <input type="checkbox" name="ord" value="11"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 11 }">checked="checked"</c:if></c:forEach>>筛分及针片状
								<input type="checkbox" name="ord" value="12"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 12 }">checked="checked"</c:if></c:forEach>>表观,表干,毛体积密度
								<input type="checkbox" name="ord" value="13"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 13 }">checked="checked"</c:if></c:forEach>>堆积,振实,捣实密度
								<input type="checkbox" name="ord" value="14"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 14 }">checked="checked"</c:if></c:forEach>>含泥量
								<input type="checkbox" name="ord" value="15"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 15 }">checked="checked"</c:if></c:forEach>>压碎值
								<input type="checkbox" name="ord" value="16"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 16 }">checked="checked"</c:if></c:forEach>>磨耗值
								<input type="checkbox" name="ord" value="17"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 17 }">checked="checked"</c:if></c:forEach>>断块抗压
								<input type="checkbox" name="ord" value="18"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 18 }">checked="checked"</c:if></c:forEach>>冲击值
							</td>
						</tr>


						<tr>
							<td>2:细集料 : <input type="checkbox" name="ord" value="21"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 21 }">checked="checked"</c:if></c:forEach>>筛分
								<input type="checkbox" name="ord" value="22"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 22 }">checked="checked"</c:if></c:forEach>>表现密度
								<input type="checkbox" name="ord" value="23"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 23 }">checked="checked"</c:if></c:forEach>>堆积,紧状密度
								<input type="checkbox" name="ord" value="24"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 24 }">checked="checked"</c:if></c:forEach>>含泥量
								, 砂当量 <input type="checkbox" name="ord" value="25"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 25 }">checked="checked"</c:if></c:forEach>>毛体积密度(>2.36mm
								个 ,<2.36mm 个)
							</td>
						</tr>

						<tr>
							<td>3.矿粉填料 <input type="checkbox" name="ord" value="31"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 31 }">checked="checked"</c:if></c:forEach>>筛分
								<input type="checkbox" name="ord" value="32"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 32 }">checked="checked"</c:if></c:forEach>>密度
								<input type="checkbox" name="ord" value="33"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 33 }">checked="checked"</c:if></c:forEach>>亲水系数
								<input type="checkbox" name="ord" value="34"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 34 }">checked="checked"</c:if></c:forEach>>塑性指数
								<input type="checkbox" name="ord" value="35"
								<c:forEach items="${orders}" var="p"><c:if test="${p.type == 35 }">checked="checked"</c:if></c:forEach>>加热安定性
							</td>
						</tr>
						<tr>
							<td>试验依据 : <<公路工程集料试验规程>>JTG E42-2005 ,
								DB50092-96 , JTG F40-2004 , JTGF30-2003 <input type="hidden"
									name="standard"
									value=" <<公路工程集料试验规程>>JTG
									E42-2005 , DB50092-96 , JTG F40-2004 , JTGF30-2003 " /></td>
						</tr>
					</table>
				</td>
				<td style="width: 60px">收费金额</td>
				<td><input size="5" name="amount" type="text"
					value="${amount }" style="width: 100%"></td>
			</tr>
			<tr>
				<td>收费人签名</td>
				<td><input size="5" name="feeearner" type="text"
					value="${feeearner }" style="width: 100%"></td>
			</tr>
		</table>
		<table id="tab">
			<tr>
				<th align="center">&nbsp;&nbsp;试样名称（<input type="button"
					id="add" value="添加">）
				</th>
				<th align="center" style="width: 70px">类别</th>
				<th align="center" style="width: 60px">级配</th>
				<th align="center" style="width: 60px">数量</th>
				<th align="center" style="width: 70px">代表数量</th>
				<th align="center" style="width: 70px">产地</th>
				<th align="center" style="width: 120px">用途</th>
			</tr>
			<c:forEach items="${oldTrialwt04s}" var="o" varStatus="sn">
				<tr id="old${sn.index}">
				<td>【<input type='button' value='删除' onclick="del('old${sn.index}');">】
				<input name="oldTrialwt04s[${sn.index}].name" class='required' value="${o.name}"/></td>
				<td><input name="oldTrialwt04s[${sn.index}].category" class='required'
					style="width: 100%" value="${o.category }"></td>
				<td><input name="oldTrialwt04s[${sn.index}].gradation"
					style="width: 100%" value="${o.gradation }"></td>
				<td><input name="oldTrialwt04s[${sn.index}].count" class='required'
					style="width: 100%" value="${o.count }"></td>
				<td><input name="oldTrialwt04s[${sn.index}].amount"  class='required'
					style="width: 100%" value="${o.amount }"></td>
				<td><input name="oldTrialwt04s[${sn.index}].origin" style="width: 100%"
				value="${o.origin}" ></td>
				<td><input name="oldTrialwt04s[${sn.index}].source" style="width: 100%" value="${o.source}"></td>
			</tr>
			</c:forEach>
			<c:if test="${empty oldTrialwt04s }">
			<tr id="0">
				<td>【<input type='button' value='删除' onclick="del('0');">】
					<input name="trialwt04s[0].name" class='required' /></td>
				<td><input name="trialwt04s[0].category" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[0].gradation" style="width: 100%"></td>
				<td><input name="trialwt04s[0].count" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[0].amount" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[0].origin" style="width: 100%"></td>
				<td><input name="trialwt04s[0].source" style="width: 100%"></td>
			</tr>
			<tr id="1">
				<td>【<input type='button' value='删除' onclick="del('1');">】
					<input name="trialwt04s[1].name" class='required' /></td>
				<td><input name="trialwt04s[1].category" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[1].gradation" style="width: 100%"></td>
				<td><input name="trialwt04s[1].count" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[1].amount" class='required'
					style="width: 100%"></td>
				<td><input name="trialwt04s[1].origin" style="width: 100%"></td>
				<td><input name="trialwt04s[1].source" style="width: 100%"></td>
			</tr>
			</c:if>
		</table>
		<table>
			<tr>
				<td>收样人</td>
				<td><input type="text" name="acceptkindpeople"
					value="${acceptkindpeople }" class='required'></td>
				<td>预约报告日期</td>
				<td><input type="text" name="reportdate" value="${reportdate }"
					class='required' id="reportDate"></td>
			</tr>
		</table>
		<div class="type-button">
			<input type="submit" id="save" class="submit" value="暂存" />&nbsp;
			<input type="button" id="submitbtn" class="submit" value="提交" />&nbsp;
			<input type="button" value="返回" class="reset"
				onclick="history.back()" />
		</div>
		</div>
	</form>
</body>
</html>